<?php

if (!defined('TOBBIVM'))
	header('location:/template/notrepassing.php');
/**
 * This file is part of TobbiVMShop.
 *
 * TobbiVMShop is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TobbiVMShop is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with TobbiVMShop.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * create adminbrowsepage
 * get: admin.tpl.php
 * used from admin.page.php
 *
 * @version    $Id$
 * @package    TobbiVM-Shop
 * @copyright  Copyright (C) 2012
 * @author     Norbert Gebert
 * @license    GPL3
 */
$refPage->assign('pageTitel', _('Administrators'));
$refPage->assign('formStart', 'index2.php?page=' . $page . '&sub=' . $subpage . '&func=0');

// create admin-table

$adminListx = array();
db::getInstance()->orderBy('user_name', 'ASC');
$admin = db::getInstance()->get('user');

$refPage->assign('tableSummary', _('Admin list') . ': ');
$refPage->assign('userId', _('ID') . ': ');
$refPage->assign('userName', _('Name') . ': ');
$refPage->assign('userLastLogin', _('Last login') . ': ');
$refPage->assign('userActive', _('Active') . ': ');

foreach ($admin as $user)
{
	$idx = $user['user_id'];
	$namex = '<a href="index2.php?page=' . $page . '&sub=' . $subpage . '&name=' .
		$user['user_name'] . '">' . $user['user_name'] . '</a>';
	$lastLoginx = $user['user_lastonline'];

	if ($user['user_active'] === 0)
	{
		$activex = '<img src="template/images/page.article/notactive.gif">';
	}
	else
	{
		$activex = '<img src="template/images/page.article/isactive.gif">';
	}

	$adminListx[] = array('adminCheckboxx' => '<input type="checkbox" name="marker[]" ' .
	 ' value="' . $user['user_id'] . '" />',
	 'adminIdx' => $idx,
	 'adminNamex' => $namex,
	 'adminLastLoginx' => $lastLoginx,
	 'adminActivx' => $activex);
}

$refPage->assign('adminListx', $adminListx);
$refPage->assign('btnNew',
	'<input type="submit" name="submit" id="new" value="' . _('New') . '" />');
$refPage->assign('btnDelete',
	'<input type="submit" name="submit" id="delete" value="' . _('Delete') . '" />');
$refPage->addtpl('content', '/' . $page . '/' . $subpage . '.tpl.php');
?>